package com.game.controllers;

import com.game.objects.Enemy;
import com.game.system.Game;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.scene.Spatial;

public class TowerEnemyController extends EnemyController{

	Spatial dyn;
	
	public TowerEnemyController(Enemy enemy) {
		super(enemy);
		Node e = (Node) enemy.getEnemy();
		dyn = e.getChild("dyn_Sphere");
		if(dyn == null){
			System.err.println("Warning: TowerController Enemy: "+enemy.getEnemy().getName()+" hast no Child named: dyn_Sphere");
			dyn = enemy.getEnemy();
		}
	}

	@Override
	public void update(float time) {
		super.update(time);
		enemy.setRotation(dyn.getLocalRotation());
		dyn.lookAt(Game.getGameLogic().getPlayer().getPlayer().getWorldTranslation(), Vector3f.UNIT_Y);
	}

}
